<?php
/* @var $this SiteController */
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/js/tabs_content.js', CClientScript::POS_HEAD);
$this->pageTitle=Yii::app()->name . ' - ' . $title;
$this->breadcrumbs=array(
	$title,
);

$src = "./images/{$page_id}/";

$items = array();
$divs_content = array();
if(!empty($tabs)){
    $active_tab = key($tabs[0]);
    $src_full = $src . $active_tab;
    
    foreach ($tabs as $tab) {
        $key = key($tab);
        if($key == $_GET['tab']){
            $active_tab = $_GET['tab'];
            $src_full = $src . $active_tab;
        }
        array_push($items, array(
            'label' => $tab[$key],
            'url' => '#',
            'linkOptions' => array('id' => $key),
        ));

        array_push($divs_content, array(
            'id' => $key,
            'title' => $tab[$key],
            'content' => $tab['content']
        ));
    }
}
if (!empty($static_tab))
    array_push($items,$static_tab);
?>

<div id="routes_content">   
        <?php     
            $this->widget('zii.widgets.CMenu', array(
		'items'=> $items,
		'htmlOptions'=>array('class'=>'tabs'),
            ));
	?>
    <div class="clear"></div>
    
    <div id="left_col">
        <?php foreach ($divs_content as $div):?>
        <div id="<?php echo $div['id']?>" <?if($div['id']==$active_tab) echo'class=active';?>>
            <h2><?php echo $div['title']?></h2>
            <?php echo $div['content']?>
        </div>
        <?php endforeach;?>
    </div>
    
    <div id="right_col">
        <img id="<?php echo $src?>" src="<?php echo $src_full?>.jpg"/>
    </div>
</div>